<?php
namespace app\common\model;

use think\Db;

class NewsType extends Common
{
    private $news_type_table = 'hn_news_type';

    /**
     * 软删除
     * @param $id
     * @return bool
     */
    public function deleteById($id)
    {
        $res=Db::table($this->news_type_table)
            ->where('id', $id)
            ->update(['is_deleted' => 1]);

        return $res !== false;
    }


    /**
     * 获取类型
     * @return false|\PDOStatement|string|\think\Collection
     */
    public function getType(){
        $where['is_deleted']=0;
        return Db::table($this->news_type_table)->where($where)->column("name");
    }

}